package com.example.ordersystem.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.ordersystem.entity.ShoppingCart;
import com.example.ordersystem.entity.vo.ShoppingCartVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ShoppingCartMapper extends BaseMapper<ShoppingCart> {

    @Select("select b.id,a.id foodId,a.name,a.picture,a.price,b.food_num foodNum\n" +
            "from food a\n" +
            "join shopping_cart b\n" +
            "on a.id=b.food_id\n" +
            "where b.user_id=#{id};")
    List<ShoppingCartVo> selectCart(String id);
}
